package avicit.bdp.dgs.mdm.dto;

import avicit.bdp.common.base.BaseDTO;
import avicit.platform6.core.annotation.log.FieldRemark;
import avicit.platform6.core.annotation.log.Id;
import avicit.platform6.core.annotation.log.LogField;
import avicit.platform6.core.properties.PlatformConstant;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;

/**
 * @金航数码科技有限责任公司
 * @作者：${tableInfo.classCreator}
 * @邮箱：${tableInfo.classMailbox}
 * @创建时间： 2023-12-06 11:02
 * @类说明：
 * @修改记录：
 */
@ApiModel(value = "MdataLogDTO", description = "日志表")
@Table(name = "bdp_dgs_mdata_log")
public class MdataLogDTO extends BaseDTO {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @Id
    @LogField
    @ApiModelProperty(value = "主键", name = "id")
    @FieldRemark(column = "id", field = "id", name = "主键")
    @javax.persistence.Id
    @Column(name = "id")
    private String id;

    /**
     * 接口ID
     */
    @LogField
    @ApiModelProperty(value = "接口ID", name = "interfaceId")
    @FieldRemark(column = "interface_id", field = "interfaceId", name = "接口ID")
    private String interfaceId;

    /**
     * 系统ID
     */
    @LogField
    @ApiModelProperty(value = "系统ID", name = "applicationId")
    @FieldRemark(column = "application_id", field = "applicationId", name = "系统ID")
    private String applicationId;

    /**
     * 调用状态，1-成功，2-失败
     */
    @LogField
    @ApiModelProperty(value = "调用状态", name = "callStatus")
    @FieldRemark(column = "call_status", field = "callStatus", name = "调用状态")
    private Integer callStatus;

    /**
     * 调用开始时间
     */
    @LogField
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(value = "调用开始时间", name = "callBeginTime")
    @FieldRemark(column = "call_begin_time", field = "callBeginTime", name = "调用开始时间")
    private Date callBeginTime;

    /**
     * 调用结束时间
     */
    @LogField
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(value = "调用结束时间", name = "callEndTime")
    @FieldRemark(column = "call_end_time", field = "callEndTime", name = "调用结束时间")
    private Date callEndTime;

    /**
     * 调用结果
     */
    @LogField
    @ApiModelProperty(value = "调用结果", name = "callResult")
    @FieldRemark(column = "call_result", field = "callResult", name = "调用结果")
    private String callResult;

    /**
     * 回调状态，1-成功，2-失败
     */
    @LogField
    @ApiModelProperty(value = "回调状态", name = "callbackStatus")
    @FieldRemark(column = "callback_status", field = "callbackStatus", name = "回调状态")
    private Integer callbackStatus;

    /**
     * 回调时间
     */
    @LogField
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(value = "回调时间", name = "callbackTime")
    @FieldRemark(column = "callback_time", field = "callbackTime", name = "回调时间")
    private Date callbackTime;

    /**
     * 推送的数据
     */
    @ApiModelProperty(value = "推送的数据", name = "data")
    @FieldRemark(column = "data", field = "data", name = "推送的数据")
    private String data;

    /**
     * 推送的数据ID集合 ["xx","xx"]
     */
    @LogField
    @ApiModelProperty(value = "推送的数据ID集合", name = "monitorIds")
    @FieldRemark(column = "monitor_ids", field = "monitorIds", name = "推送的数据ID集合")
    private String monitorIds;

    @Transient
    private String applicationName;
    @Transient
    private String interfaceName;
    @Transient
    private String interfaceCode;
    @Transient
    private String callStatusName;
    @Transient
    private String callbackStatusName;

    public String getMonitorIds() {
        return monitorIds;
    }

    public void setMonitorIds(String monitorIds) {
        this.monitorIds = monitorIds;
    }

    public String getCallStatusName() {
        return callStatusName;
    }

    public void setCallStatusName(String callStatusName) {
        this.callStatusName = callStatusName;
    }

    public String getCallbackStatusName() {
        return callbackStatusName;
    }

    public void setCallbackStatusName(String callbackStatusName) {
        this.callbackStatusName = callbackStatusName;
    }

    public String getApplicationName() {
        return applicationName;
    }

    public void setApplicationName(String applicationName) {
        this.applicationName = applicationName;
    }

    public String getInterfaceName() {
        return interfaceName;
    }

    public void setInterfaceName(String interfaceName) {
        this.interfaceName = interfaceName;
    }

    public String getInterfaceCode() {
        return interfaceCode;
    }

    public void setInterfaceCode(String interfaceCode) {
        this.interfaceCode = interfaceCode;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getInterfaceId() {
        return interfaceId;
    }

    public void setInterfaceId(String interfaceId) {
        this.interfaceId = interfaceId;
    }

    public String getApplicationId() {
        return applicationId;
    }

    public void setApplicationId(String applicationId) {
        this.applicationId = applicationId;
    }

    public Integer getCallStatus() {
        return callStatus;
    }

    public void setCallStatus(Integer callStatus) {
        this.callStatus = callStatus;
    }

    public Date getCallBeginTime() {
        return callBeginTime;
    }

    public void setCallBeginTime(Date callBeginTime) {
        this.callBeginTime = callBeginTime;
    }

    public Date getCallEndTime() {
        return callEndTime;
    }

    public void setCallEndTime(Date callEndTime) {
        this.callEndTime = callEndTime;
    }

    public String getCallResult() {
        return callResult;
    }

    public void setCallResult(String callResult) {
        this.callResult = callResult;
    }

    public Integer getCallbackStatus() {
        return callbackStatus;
    }

    public void setCallbackStatus(Integer callbackStatus) {
        this.callbackStatus = callbackStatus;
    }

    public Date getCallbackTime() {
        return callbackTime;
    }

    public void setCallbackTime(Date callbackTime) {
        this.callbackTime = callbackTime;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public String getLogFormName() {
        if (StringUtils.isEmpty(super.logFormName)) {
            return "bdp_dgs_mdata_log";
        } else {
            return super.logFormName;
        }
    }

    public String getLogTitle() {
        if (StringUtils.isEmpty(super.logTitle)) {
            return "bdp_dgs_mdata_log";
        } else {
            return super.logTitle;
        }
    }

    public PlatformConstant.LogType getLogType() {
        if (super.logType == null) {
            return PlatformConstant.LogType.module_operate;
        } else {
            return super.logType;
        }
    }

}
